All Functions Used So Far, Week 9

desc

{dplyr}

Arrange in descending order

max

{base}

Get maximum of a vector

levels

{base}

Get levels of a factor

ordered

{dplyr}

Create an ordered factor

names

{base}

Retrieve names of a list/vector

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

with

{base}

evaluate expression in the context of a data frame

var

{stats}

Calculate variance

ungroup

{dplyr}

Resolve grouping created with “group_by”

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

read.csv

{utils}

Read a csv file to data frame. Specify stringsAsFactors = FALSE to keep all string columns as characters

library

{base}

Load an R package

separate

{dplyr}

Separate a character column into multiple columns

is.na

{base}

Check if a value is NA/elements of vector are NA

ggplot

{GGPLOT2}

Create a ggplot graph

n

{dplyr}

The number of observations in the current group.

labs

{GGPLOT2}

Customise labels in GGPLOT2

mean

{base}

Get mean of a vector

write.csv

{utils}

write a csv file to a data frame

min

{base}

Get minimum of a vector

read_dta

{haven}

Read a .dta file (Stata data)

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

c

{base}

Combine values/vectors into a vector

boxplot

{graphics}

Plot a simple box plot

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

data.frame

{base}

Create a data.frame from vectors

sd

{stats}

Get standard deviation of a vector

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

factor

{base}

Create a factor

head

{utils}

Show first 5 rows of a data frame

write_dta

NA

slice

{dplyr}

Subset rows using their positions

mutate

{dplyr}

Modify/create a column in a data frame

select

{dplyr}

Select columns from a tibble/data frame

seq

{base}

Create a sequence

summarize

NA

t.test

{stats}

Performs one and two sample t-tests on vectors of data.

sum

{base}

Get sum of numeric values or a vector

spread

{tidyr}

Spread a key-value pair across multiple columns

read_excel

{readxl}

Read an Excel file

geom_histogram

{GGPLOT2}

Generates a histogram

summary

{base}

Obtain summary statistics or detailed regression output

complete.cases

{stats}

Find Complete Cases

setwd

{base}

Set Working Directory

filter

{dplyr}

Filter out rows of a data frame according to logical vector

cut

{base}

Convert Numeric to Factor

ifelse

{base}

Return a or b depending on the value of test

hist

{graphics}

Plot a simple histogram

recode

{dplyr}

Recode a variable

range

{base}

Return range of values

save

{base}

Writes an external representation of R objects to the specified file.

prop.test

{stats}

Test of Equal or Given Proportions

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

as.numeric

{base}

Coerce a vector to numeric

str

{utils}

Get the structure of an R object

as.character

{base}

Coerce a vector to character

median

{stats}

Get median of a vector

The end!